<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成绩信息管理</title>
    <link rel="stylesheet" href="./login.css">
    
</head>
<body>
    <div class="loginCard">
            <h1 >
                <style>
                    h1{
                        text-align: center;
                    }
                </style>
                成绩信息
            </h1>
    

            <div class="form-group">
                <form action="sel_SC.php" method="get">
                    <label for="exampleInputEmail1">学号:&nbsp;&nbsp;&nbsp;</label>
                    <input type="text" name="st_id" class="form-control" id="exampleInputEmail1" placeholder="请输入学生学号">
                    <label for="exampleInputEmail1">课程号:&nbsp;&nbsp;&nbsp;</label>
                    <input type="text" name="cs_id" class="form-control" id="exampleInputEmail1" placeholder="请输入课程号">
                    <input type='submit' value='查询'>
                </form>
            </div>
            
            <?php
                 header("Content-type:text/html;charset=utf-8");
                 $con = mysqli_connect("localhost", 'root', '', 'ksdb2');
                 mysqli_set_charset($con, "utf8");

                 
                 $sql='select select_course.st_id, student.st_name, select_course.cs_id, course.cs_name, sc_grade from student, course, select_course where select_course.st_id=student.st_id and select_course.cs_id = course.cs_id;';
                 $result = mysqli_query($con,$sql);
                 echo "<table border='1'><tr><th>学号</th>
                 <th>姓名</th>
                 <th>课程号</th>
                 <th>课程名</th>
                 <th>成绩</th>
                 </tr>";
                 while($row = mysqli_fetch_array($result)){
                    echo "<tr>";
                    echo "<td>" . $row['st_id'] . "</td>";
                    echo "<td>" . $row['st_name'] . "</td>";
                    echo "<td>" . $row['cs_id'] . "</td>";
                    echo "<td>" . $row['cs_name'] . "</td>";
                    echo "<td>" . $row['sc_grade'] . "</td>";
                    
                    echo "<tr>";
                 }
                 echo "</table>";
                 
                
	             mysqli_close($con);
            ?>
            <br>
            
            <div>
                <button>
                    <a href="add_SC.html">添加</a>
                </button>
                <button>
                    <a href="upd_SC.html">修改</a>
                </button>
                <button>
                    <a href="del_SC.html">删除</a>
                </button>
                <button>
                    <a href="main.html">返回</a>
                </button>
            </div>
            
                
            

       
       
    </div>
</body>
</html>